package com.example.superoa.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.example.superoa.model.service.ReportService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

@Controller
public class ReportController {
	@Autowired
	private ReportService rs;
	@RequestMapping("salary-report")
	public void show() {
		
	}
	@RequestMapping("salary-hbreport")
	public void hbshow() {
		
	}
	@RequestMapping("find-report")
	@ResponseBody
	public JSONArray findReport() {
		return rs.findAllReport();
	}
	@RequestMapping("find-month")
	@ResponseBody
	public JSONArray findReport1() {
		return rs.selectmonth();
	}
	@RequestMapping("find-jidu")
	@ResponseBody
	public JSONArray findReport2() {
		return rs.selectjidu();
	}
	@RequestMapping("find-year")
	@ResponseBody
	public JSONArray findReport3() {
		return rs.selectyear();
	}
	@RequestMapping("show-chaxunreport")
	@ResponseBody
	public Map<String,Object> test1(int page,int rows) {
		Map<String,Object> map = new HashMap<>();
			//先分页
		Page<Object> pg = PageHelper.startPage(page, rows);		
		JSONArray i=rs.cx();
		//总记录
		map.put("total", pg.getTotal());
		//页内容
		map.put("rows", i);
		return map;
	}
}
